System Color Control Sample - created by Randy Russell - June 1997 ActiveX Control created with Microsoft Visual Basic 5.0 This sample presents a scrollable ListView type collection of the current Windows System Colors. The sample could be easily modified to display icons, bitmaps or whatever you have in mind. It currently displays a 3D box filled with with the system color next to each system color name. It is mostly hard coded, using only a scroll bar, so it is very flexible and lightweight. Open the project group SysColors.vbg to review the entire sample. If you open the SysColorSample.vbp project you will receive a load error because the SysColorControl is not in that project. You can open the SysColorControl.vbp project to review or compile the control separately. If you remove the SysColors control from the SysColorSample project then you will be able to work with the class/form version alone. I included a form version of the control that can be displayed independent of a container, i.e., popup. The form is wrapped by the SysColors class that could be added to a dll component for reusability. Click the Popup button for a demonstration of the popup form. The control could also be used as a popup by setting its visible property accordingly, however, it will be confined to its container. The control sets two read-only properties when a selection is made: SelectedColor - Actual System Color value - Long SelectedColorName - System Color name - String If you right-click the control, the SelectedColorName property is set to "". This could be changed to leave the current color selected so you would not have to watch for the "" condition by changing the line under "If button = 2 Then" in the MouseDown procedure to Exit Sub. I added a ClickType property to the control so you can choose whether a single or a double click is required to set the selection. This property can also be added to the popup form version but I did not implement it here. This property is demonstrated by the "Set to Single Click" button. The control will display a default color which is highlighted. You can select which color will be displayed as the default by setting the DefaultColor property. As a fun project, you could convert the sample into a drop-down system color control. It would be fairly straightforward as long as you understand the sample as is. You could change the initial size to display only one row, add a small button with a down arrow that, when clicked, refreshed the form to its full size (dropped), and then have it display the selected color as the top row and return it to the one row size when the user makes a selection. Voila - a dropdown, scrollable list view type, system color control. I hope you like the sample and Keep on Codin'. Randy Russell 73774,1126@compuserve.com